package view;

import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Graphics2D;
import java.awt.BorderLayout;

import javax.swing.JFrame;
import javax.swing.JPanel;

import control.DrawListener;

public class Board extends JFrame {
	private int width;
	private int height;

	public Board(int width, int height) {
		this.width = width;
		this.height = height;
	}

	public void initBoard() {
		setTitle("CAD");
		setDefaultCloseOperation(EXIT_ON_CLOSE);
		setLocationRelativeTo(null);
		setSize(width, height);

		DrawPanel dPanel = new DrawPanel(900, 700);
		this.add(dPanel, BorderLayout.CENTER);

		ToolsPanel tPanel = new ToolsPanel(124, 700);
		this.add(tPanel, BorderLayout.EAST);

		setVisible(true);

		Graphics2D g = (Graphics2D) dPanel.getGraphics();
		DrawListener listener = new DrawListener(dPanel, tPanel, g);
		dPanel.addMouseListener(listener);
		dPanel.addMouseMotionListener(listener);
	}
}
